package cn.itsource.hrm.feignclients;

import cn.itsource.hrm.fallback.RedisFeignClientFallbackFactory;
import cn.itsource.hrm.util.AjaxResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = "redis-server",fallbackFactory = RedisFeignClientFallbackFactory.class)//写远程调用的服务名
public interface RedisFeignClient {
    //写上要调用的远程的方法，不要方法体
    @PostMapping("/redis/set")
    public AjaxResult set(@RequestParam("key") String key, @RequestParam("value") String value);

    @PostMapping("/redis/setex")
    public AjaxResult setex(@RequestParam("key") String key,@RequestParam("seconds") int seconds, @RequestParam("value") String value);

    @GetMapping("/redis/get/{key}")
    public AjaxResult get(@PathVariable("key") String key);

}
